<?php
$url["lang"] = $_GET["lang"];
$url["email"] = $_GET["email"];


//Answers given by the user
$url["uToPrice"] =		$_GET["r1"];
$url["uToSchedule"] =	$_GET["r2"];
$url["uToDayOff"] =		$_GET["r3"];
$url["uToAverage"] =	$_GET["r4"];

$url["sToPrice"] =		$_GET["s1"];
$url["sToSchedule"] =	$_GET["s2"];
$url["sToDayOff"] =		$_GET["s3"];
$url["sToAverage"] =	$_GET["s4"];

$dDigits=3;
//Surprise Context
$url["csCheap"] = 		round($_GET["csCheap"],$dDigits);
$url["csAverage"] = 	round($_GET["csAverage"],$dDigits);
$url["csExpensive"] = 	round($_GET["csExpensive"],$dDigits);
$url["csMorning"] = 	round($_GET["csMorning"],$dDigits);
$url["csAfternoon"] = 	round($_GET["csAfternoon"],$dDigits);
$url["csNight"] = 		round($_GET["csNight"],$dDigits);
$url["csSunday"] = 		round($_GET["csSunday"],$dDigits);
$url["csMonday"] = 		round($_GET["csMonday"],$dDigits);
$url["csTuesday"] = 	round($_GET["csTuesday"],$dDigits);
$url["csWednesday"] = 	round($_GET["csWednesday"],$dDigits);
$url["csThursday"] = 	round($_GET["csThursday"],$dDigits);
$url["csFriday"] = 		round($_GET["csFriday"],$dDigits);
$url["csSaturday"] = 	round($_GET["csSaturday"],$dDigits);

//Uncertainty Context
$url["cuCheap"] = 		round($_GET["cuCheap"],$dDigits);
$url["cuAverage"] = 	round($_GET["cuAverage"],$dDigits);
$url["cuExpensive"] = 	round($_GET["cuExpensive"],$dDigits);
$url["cuMorning"] = 	round($_GET["cuMorning"],$dDigits);
$url["cuAfternoon"] = 	round($_GET["cuAfternoon"],$dDigits);
$url["cuNight"] = 		round($_GET["cuNight"],$dDigits);
$url["cuSunday"] = 		round($_GET["cuSunday"],$dDigits);
$url["cuMonday"] = 		round($_GET["cuMonday"],$dDigits);
$url["cuTuesday"] = 	round($_GET["cuTuesday"],$dDigits);
$url["cuWednesday"] = 	round($_GET["cuWednesday"],$dDigits);
$url["cuThursday"] = 	round($_GET["cuThursday"],$dDigits);
$url["cuFriday"] = 		round($_GET["cuFriday"],$dDigits);
$url["cuSaturday"] = 	round($_GET["cuSaturday"],$dDigits);

$url["aID"] = 			$_GET["aID"];
$url["aPoiID"] = 		$_GET["aPoiID"];
$url["aRunID"] = 		$_GET["aRunID"];
$url["aAgentGoal"] = 	$_GET["aAgentGoal"];

//Agent Surprise
$url["asCheap"] = 		round($_GET["asCheap"],$dDigits);
$url["asAverage"] = 	round($_GET["asAverage"],$dDigits);
$url["asExpensive"] = 	round($_GET["asExpensive"],$dDigits);
$url["asMorning"] = 	round($_GET["asMorning"],$dDigits);
$url["asAfternoon"] = 	round($_GET["asAfternoon"],$dDigits);
$url["asNight"] = 		round($_GET["asNight"],$dDigits);
$url["asSunday"] = 		round($_GET["asSunday"],$dDigits);
$url["asMonday"] = 		round($_GET["asMonday"],$dDigits);
$url["asTuesday"] = 	round($_GET["asTuesday"],$dDigits);
$url["asWednesday"] = 	round($_GET["asWednesday"],$dDigits);
$url["asThursday"] = 	round($_GET["asThursday"],$dDigits);
$url["asFriday"] = 		round($_GET["asFriday"],$dDigits);
$url["asSaturday"] = 	round($_GET["asSaturday"],$dDigits);

//Agent Uncertainty
$url["auCheap"] = 		round($_GET["auCheap"],$dDigits);
$url["auAverage"] = 	round($_GET["auAverage"],$dDigits);
$url["auExpensive"] = 	round($_GET["auExpensive"],$dDigits);
$url["auMorning"] = 	round($_GET["auMorning"],$dDigits);
$url["auAfternoon"] = 	round($_GET["auAfternoon"],$dDigits);
$url["auNight"] = 		round($_GET["auNight"],$dDigits);
$url["auSunday"] = 		round($_GET["auSunday"],$dDigits);
$url["auMonday"] = 		round($_GET["auMonday"],$dDigits);
$url["auTuesday"] = 	round($_GET["auTuesday"],$dDigits);
$url["auWednesday"] = 	round($_GET["auWednesday"],$dDigits);
$url["auThursday"] = 	round($_GET["auThursday"],$dDigits);
$url["auFriday"] = 		round($_GET["auFriday"],$dDigits);
$url["auSaturday"] = 	round($_GET["auSaturday"],$dDigits);

//Master Agent Knowledge
$url["mCheap"] = 		round($_GET["mCheap"],$dDigits);
$url["mAverage"] = 		round($_GET["mAverage"],$dDigits);
$url["mExpensive"] = 	round($_GET["mExpensive"],$dDigits);
$url["mMorning"] = 		round($_GET["mMorning"],$dDigits);
$url["mAfternoon"] = 	round($_GET["mAfternoon"],$dDigits);
$url["mNight"] = 		round($_GET["mNight"],$dDigits);
$url["mSunday"] = 		round($_GET["mSunday"],$dDigits);
$url["mMonday"] = 		round($_GET["mMonday"],$dDigits);
$url["mTuesday"] = 		round($_GET["mTuesday"],$dDigits);
$url["mWednesday"] = 	round($_GET["mWednesday"],$dDigits);
$url["mThursday"] = 	round($_GET["mThursday"],$dDigits);
$url["mFriday"] = 		round($_GET["mFriday"],$dDigits);
$url["mSaturday"] = 	round($_GET["mSaturday"],$dDigits);


include("dbconnection.php");
$db = new PDO("sqlite:ex3_POIsDB.db3", 'w+');
saveData($db,$url);
$db = null;

$cQuestion =$_GET["cQuestion"];
if($cQuestion==65){
	header("Location: end.php");
}else{
	$url2["lang"] = 	$_GET["lang"];
	$url2["email"] = 	$_GET["email"];
	$link = "login.php?".http_build_query($url2)." ";
	header("Location: $link");
	
	//$link = "login.php?".http_build_query($url2)." ";
	//echo '<script> window.location="'.$link.'"; </script> ';
}
?>